package algotithm.leetcode.math.test1266;

/**
 * @author 25068
 * @Date 2021/5/10 9:02
 * @Title 1266. 访问所有点的最小时间
 */
public class Solution {

    public static void main(String[] args) {
        int[][] points = {{1,1},{3,4},{-1,0}};
        Solution solution = new Solution();
        int res = solution.minTimeToVisitAllPoints(points);
        System.out.println(res);
    }


    public int minTimeToVisitAllPoints(int[][] points) {
        int res=0;
        for(int i=0;i<points.length;i++){
            if(i+1 < points.length ){
                res += Math.max(Math.abs(points[i][0]-points[i+1][0]),Math.abs(points[i][1]-points[i+1][1]));
            }
        }
        return res;
    }
}


